/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ${USER}
 * Date: ${YEAR}-${MONTH}-${DAY}
 * Time: ${TIME}
 */
class Animal{

}
class Dog extends Animal{
    public Animal test(){
        return new Dog();//函数返回值为父类引用类型，而真实返回值为子类引用类型，向上转型。

    }
}
public class Main {
    public static void main(String[] args) {
        System.out.println("Hello world!");
        Dog dog = new Dog();
        Animal t = dog.test();//返回值用父类类型接收
    }
}